package com.woniuxy.controller;

import com.woniuxy.service.SysDoctorTeamService;
import com.woniuxy.util.ResponseUtil;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 系统医生团队控制器
 * 处理系统医生团队相关的HTTP请求
 */
@RestController
@RequestMapping("/sysDoctorTeam")
public class SysDoctorTeamController {
    @Resource
    private SysDoctorTeamService sysDoctorTeamService;
    /**
     * 根据角色和医生ID查询系统团队
     * @param role 角色
     * @param doctorId 医生ID
     * @return 返回指定角色和医生的团队信息
     */
    @GetMapping("/{role}/{doctorId}")
    public ResponseUtil findSysTeam(@PathVariable Integer role, @PathVariable Integer doctorId) {
        return sysDoctorTeamService.findSysTeam(role,doctorId);
    }
    /**
     * 更新系统医生团队关联关系
     * @param doctorId 医生ID
     * @param teamId 团队ID
     * @return 返回更新操作的响应结果
     */
    @PutMapping("/{doctorId}/{teamId}")
    public ResponseUtil updateSysDoctorTeam(@PathVariable Integer doctorId, @PathVariable Integer teamId) {
        return sysDoctorTeamService.updateSysDoctorTeam(doctorId,teamId);
    }

    /**
     * 查询团队成员
     * @param teamId 团队ID
     * @return 返回团队成员列表
     */
    @GetMapping("/{teamId}/members")
    public ResponseUtil findMembersByTeamId(@PathVariable Integer teamId){
        return sysDoctorTeamService.findMembersByTeamId(teamId);
    }
    
    /**
     * 添加团队成员
     * @param doctorId 医生ID
     * @param teamId 团队ID
     * @return 返回添加结果
     */
    @PostMapping("/{doctorId}/{teamId}")
    public ResponseUtil addDoctorTeamMember(@PathVariable Integer doctorId, @PathVariable Integer teamId){
        return sysDoctorTeamService.addDoctorTeamMember(doctorId, teamId);
    }
}
